package com.hongxun.budget.ui.activity.sg;

import android.app.FragmentTransaction;
import android.os.Bundle;
import android.widget.TextView;

import com.hongxun.budget.R;
import com.hongxun.budget.ui.activity.BaseActivity;
import com.hongxun.budget.ui.fragment.sg.BrowseHideProInfoList;
import com.hongxun.budget.ui.fragment.sg.ClearCacheFragment;
import com.hongxun.budget.ui.fragment.sg.OnlineProjectList;
import com.hongxun.budget.utils.SgStrKey;

import butterknife.BindView;

/**
 * 辅助型界面
 */
public class AuxiliaryActivity extends BaseActivity {
    @BindView(R.id.center_title)
    TextView centerTitle;
    private String tabName;

    @Override
    public int getLayoutId() {
        return R.layout.sg_activity_flayout;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        changeTab();
    }

    private void changeTab() {
        tabName = getIntent().getStringExtra("tabName");
        centerTitle.setText(tabName);
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        switch (tabName) {
            case SgStrKey.ybgcxxlb:
                BrowseHideProInfoList infoListFragment2 = new BrowseHideProInfoList();
                transaction.replace(R.id.flayout1, infoListFragment2, tabName).commit();
                break;
            case SgStrKey.sgxmlb:
                OnlineProjectList projectFragment = new OnlineProjectList();
                transaction.replace(R.id.flayout1, projectFragment, tabName).commit();
                break;
            case SgStrKey.clearcache:
                ClearCacheFragment cacheFragment = new ClearCacheFragment();
                transaction.replace(R.id.flayout1, cacheFragment, tabName).commit();
                break;
        }
    }

}
